// Freeze Cannon

ACTOR FreezeCannon : IDMWeapon
{
  Weapon.SelectionOrder 50
  Weapon.SlotNumber 7
  Weapon.AmmoUse 2
  Weapon.AmmoGive 100
  Weapon.AmmoType "IDMCell"
  Weapon.PreferredSkin "FreezeMarine"
  Inventory.PickupMessage "Freeze Cannon!"
  Tag "Freeze Cannon"
  +WEAPON.BFG
  +WEAPON.NOLMS
  States
  {
  Ready:
    FRSG A 1 A_WeaponReady
    Loop
  Deselect:
    FRSG A 1 A_Lower
    Loop
  Select:
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    FRSG A 1 A_Raise
    Loop
  Fire:
	FRSG A 0 A_Playsound("weapons/freezecnnf",CHAN_WEAPON)
	FRSG A 18 A_GunFlash
	Goto Hold
  Quad:
    TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	Goto Hold+2
  Hold:
	TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2")
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
    FRSG A 0 A_GunFlash("Flash2")
	FRSG A 4 A_FireCustomMissile("FreezeBall",random(-8,8),1,0,0,0)
  FireEnd:
	TNT1 A 0 A_Refire
	TNT1 A 0 A_GunFlash("Flash3")
    FRSG B 30
    Goto Ready
  QuadLevel2:
    TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	Goto Level2+1
  Level2:
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLevel2")
    FRSG A 0 A_GunFlash("Flash2")
	FRSG A 0 A_FireCustomMissile("FreezeBall",random(-8,8),0)
	FRSG A 5 A_FireCustomMissile("FreezeBall",random(-8,8))
	Goto FireEnd
  Flash:
	FRSG A 10 Bright
	FRSF AB 4 Bright
	Goto LightDone
  Flash2:
    FRSF A 3 Bright A_Light1
	FRSF B 2 Bright A_Light1
    Goto LightDone
  Flash3:
	FRSG B 5 Bright A_Light1
	Goto LightDone
  Spawn:
    FRAS A -1 Bright
    Stop
  }
}

// Freeze Cannon Snowball

ACTOR FreezeBall : FastProjectile
{
  Radius 13
  Height 8
  Speed 80
  Damage (40 * random(1,5))
  Projectile
  RenderStyle Add
  Alpha 0.75
  SeeSound "weapons/freezeshot"
  DeathSound "weapons/freezehit"
  Obituary "%o got frozen solid by %k's Freeze Cannon."
  DamageType Ice
  Decal FreezeBlastMelt
  +RANDOMIZE
  States
  {
  Spawn:
    FBLS A 1 bright A_SpawnItem("FreezeBallTrail")
    loop
  Death:
	TNT1 A 0
    FBLS BCDE 4 bright
    stop
  }
}

ACTOR FreezeBallTrail
{
  Radius 13
  Height 8
  Damage 0
  Projectile
  +RANDOMIZE
  +CLIENTSIDEONLY
  RenderStyle Add
  Alpha 0.75
  SeeSound "weapons/iceshot"
  DeathSound "weapons/icehit"
  Obituary "%o got frozen solid by %k's Freeze Cannon."
  States
  {
  Spawn:
    FRTR ABC 6 bright A_FadeOut(0.2)
    loop
  Death:
    FRTR ABC 4 bright
    stop
  }
}